﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Entites
{
    public static class DbInitializer
    {
        public static void Initialize(ApplicationDbContext context)
        {if (context != null)
            {
                context.Database.EnsureCreated();

                // Look for any students.
                if (context.User.Any())
                {
                    return;   // DB has been seeded
                }

                var Users = new User[]
                {
                new User{ username="admin",paswword="admin",UserRoles=null },
                new User{ username="test",paswword="test",UserRoles=null }
                };
                foreach (User s in Users)
                {
                    context.User.Add(s);
                }
                context.SaveChanges();
            }
           
        }
    }
}

